import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class EntryMenu extends javax.swing.JPanel {
    JPanel mainPanel;
    
    public EntryMenu(JPanel panel) {
        mainPanel = panel;
        initComponents();
        
        //Entry Menu button connections
        addNewEntryButton.addActionListener(new PanelSwitchToAddNewEntry());
        viewEntryButton.addActionListener(new PanelSwitchToViewEntry());
        editEntryButton.addActionListener(new PanelSwitchToEditEntry());
        deleteEntryButton.addActionListener(new PanelSwitchToDeleteEntry());
        
        backButton.addActionListener(new PanelSwitchToCalendar());
    }

    
    @SuppressWarnings("unchecked")
    private void initComponents() {

        jLabel8 = new javax.swing.JLabel();
        addNewEntryButton = new javax.swing.JButton();
        viewEntryButton = new javax.swing.JButton();
        editEntryButton = new javax.swing.JButton();
        deleteEntryButton = new javax.swing.JButton();
        backButton = new javax.swing.JButton();
        dateLabel = new javax.swing.JLabel();

        jLabel8.setFont(new java.awt.Font("DejaVu Sans", 1, 36)); // NOI18N
        jLabel8.setText("Diary Entry Menu");

        addNewEntryButton.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
        addNewEntryButton.setText("Add New Entry");

        viewEntryButton.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
        viewEntryButton.setText("View Entry");

        editEntryButton.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
        editEntryButton.setText("Edit Entry");

        deleteEntryButton.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
        deleteEntryButton.setText("Delete Entry");

        backButton.setFont(new java.awt.Font("DejaVu Sans", 0, 18)); // NOI18N
        backButton.setText("Back");

        dateLabel.setFont(new java.awt.Font("DejaVu Sans", 3, 18)); // NOI18N
        dateLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(158, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(138, 138, 138))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(viewEntryButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(addNewEntryButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
                            .addComponent(editEntryButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(deleteEntryButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(dateLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
                        .addGap(187, 187, 187))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(backButton)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel8)
                .addGap(26, 26, 26)
                .addComponent(dateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(addNewEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(viewEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(editEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(deleteEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 116, Short.MAX_VALUE)
                .addComponent(backButton)
                .addContainerGap())
        );
    }

    class PanelSwitchToCalendar implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            CardLayout c = (CardLayout)(mainPanel.getLayout());
            c.show(mainPanel, "Calendar");
        }
    }
    
    class PanelSwitchToAddNewEntry implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            CardLayout c = (CardLayout)(mainPanel.getLayout());
            c.show(mainPanel, "Add");
        }
    }
    
    class PanelSwitchToViewEntry implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            CardLayout c = (CardLayout)(mainPanel.getLayout());
            c.show(mainPanel, "ViewEntry");
        }
    }
    
    class PanelSwitchToEditEntry implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            CardLayout c = (CardLayout)(mainPanel.getLayout());
            c.show(mainPanel, "Edit");
        }
    }
    
    class PanelSwitchToDeleteEntry implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            CardLayout c = (CardLayout)(mainPanel.getLayout());
            c.show(mainPanel, "DeleteEntry");
        }
    }
    
    private javax.swing.JButton addNewEntryButton;
    private javax.swing.JButton backButton;
    private javax.swing.JButton deleteEntryButton;
    private javax.swing.JButton editEntryButton;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JButton viewEntryButton;
    
    static javax.swing.JLabel dateLabel; //Used globally over all GUI
    									 //Read the date that the user chooses
}
